export let verifyPassword = password => {
    return () => {
        let p = password()
        let temp = 0
        if (/[0-9]/.test(p)) {
            temp += 1
        }
        if (/[a-zA-Z]/.test(p)) {
            temp += 1
        }
        if (/(?=.*[^a-zA-Z0-9])/.test(p)) {
            temp += 1
        }
        if (/[\u4E00-\u9FFF]+/g.test(p)) {
            return false
        }
        if (p.length > 20 || p.length < 8) {
            return false
        }
        if (/\s/.test(p)) {
            return false
        }
        if (temp > 1) {
            return true
        } else {
            return false
        }
    }
}
export let verifyPasswordAgain = (password, passwordAgain) => {
    return () => {
        let p1 = password(), p2 = passwordAgain()
        return p1 == p2 && p2 != ''
    }
}
export let rule = {
    name: {
        msg: '用户名不能为空'
    },
    password: {
        msg: '密码不能为空'
    },
    phone: {
        rule: /^1(3|4|5|6|7|8|9)\d{9}$/,
        msg: '请输入正确手机号码'
    },
    authCode: {
        rule: /^([a-z]|[A-Z]|[0-9]){4}$/,
        msg: '请输入正确图形验证码'
    },
    phoneCode: {
        rule: /^([0-9]){6}$/,
        msg: '请输入6位手机验证码'
    },
}
export let mainImageRule = (__this, rule, value, callback) => {
    if (!__this.mainNode.image_group) {
        return callback(new Error('请选择环境'));
    }
    callback();
};
export let mainProductRule = (__this, rule, value, callback) => {
    if (!__this.mainNode.product_id) {
        return callback(new Error('请选择资源组'));
    }
    callback();
};
export let slaveImageRule = (__this, rule, value, callback) => {
    if (!__this.mainNode.image_id) {
        return callback(new Error('请选择环境'));
    }
    callback();
};

export let mainCommandRule = (__this, rule, value, callback) => {
    if (!__this.mainNode.command) {
        return callback(new Error('请选择环境'));
    }
    callback();
};